<?php
/**
 * @企业类
 * 1、企业列表
 * 2、企业详情
 */

namespace app\admin\controller;

use app\common\controller\HomeCommon;
use app\common\model\Label;
use think\Cache;
use think\Config;
use think\Controller;
use think\Request;
use think\View;

class Common extends Controller
{
    public function __construct()
    {
        parent::__construct();
    }


    public  function get_city(){
        $id=request()->param('id',1,'intval');

        $list=db('city')->where(['pid'=>$id])->select();

        return json(['code'=>1,'data'=>$list,'msg'=>'获取成功']);

    }
    public  function chain(){
        $id=request()->param('id',0,'intval');

        $label =new Label();


        //产业链
        $chain=$label->chain($id);

        return json(['code'=>1,'data'=>$chain,'msg'=>'获取成功']);
    }
    public  function industry(){
        $id=request()->param('id',0,'intval');

        $label =new Label();


        //产业链
        $chain=$label->industry($id);

        return json(['code'=>1,'data'=>$chain,'msg'=>'获取成功']);

    }

    public function get_park()
    {
        $keyword=request()->param('keyword',0,'trim');
        $result=db('parks')
            ->where('status',1)
            ->where('park_name','like','%'.$keyword.'%')
            ->column('park_name','id');
        return $result;
    }

    public function get_company()
    {
        $keyword=request()->param('keyword',0,'trim');
        $result=db('companys')
            ->where('status',1)
            ->where('company_name','like','%'.$keyword.'%')
            ->column('company_name','id');
        return $result;
    }
}
